﻿using System;

namespace PlottingBasics.Functions
{
    /// <summary>
    /// Creates a gausian function
    /// </summary>
    public class Gaussian
    {

        /// <summary>
        /// Creates a gausian function
        /// </summary>
        /// <param name="p"></param>
        /// <param name="p_2"></param>
        /// <returns></returns>
        public static Func<double, double> Gauss(double mean, double width)
        {
            double ANorm = 1 / (width * Math.Sqrt(2 * Math.PI));
            return x =>
            {
                return ANorm * Math.Exp(-(x - mean) * (x - mean) / 2.0 / width / width);
            };
        }
    }
}
